package im.youni.horus.dubbo;

import org.springframework.core.io.ClassPathResource;

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

public class Configer {

    private static Properties cache = new Properties();

    //读取配置文件
    static {
        try {
            cache.load(
                    new InputStreamReader(Configer.class.getClassLoader().getResourceAsStream("app.properties"),
                            "gbk"));     //文件流的编码方式
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    //获取指定key的值
    public static String getValue(String key) {
        return cache.getProperty(key);
    }

}
